package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class RecipeTest extends TestCase {
	Recipe recipe;
	
	@Before
	public void setUp() throws Exception {
		recipe = new Recipe();
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAmtChocolate() {
		assertEquals(0, recipe.getAmtChocolate());
	}

	@Test
	public void testSetAmtChocolate() {
		recipe.setAmtChocolate(2);
		assertEquals(2, recipe.getAmtChocolate());

		recipe.setAmtChocolate(-1);
		assertEquals(0, recipe.getAmtChocolate());
	}

	@Test
	public void testGetAmtCoffee() {
		assertEquals(0, recipe.getAmtCoffee());
	}

	@Test
	public void testSetAmtCoffee() {
		recipe.setAmtCoffee(2);
		assertEquals(2, recipe.getAmtCoffee());

		recipe.setAmtCoffee(-1);
		assertEquals(0, recipe.getAmtCoffee());
	}

	@Test
	public void testGetAmtMilk() {
		assertEquals(0, recipe.getAmtMilk());
	}

	@Test
	public void testSetAmtMilk() {
		recipe.setAmtMilk(2);
		assertEquals(2, recipe.getAmtMilk());

		recipe.setAmtMilk(-1);
		assertEquals(0, recipe.getAmtMilk());
	}

	@Test
	public void testGetAmtSugar() {
		assertEquals(0, recipe.getAmtSugar());
	}

	@Test
	public void testSetAmtSugar() {
		recipe.setAmtSugar(2);
		assertEquals(2, recipe.getAmtSugar());

		recipe.setAmtSugar(-1);
		assertEquals(0, recipe.getAmtSugar());
	}

	@Test
	public void testGetName() {
		assertNull(recipe.getName());
	}

	@Test
	public void testSetName() {
		recipe.setName("Instant Coffee");
		assertSame("Instant Coffee", recipe.getName());
	}

	@Test
	public void testGetPrice() {
		assertEquals(0, recipe.getPrice());
	}

	@Test
	public void testSetPrice() {
		recipe.setPrice(2);
		assertEquals(2, recipe.getPrice());

		recipe.setPrice(-1);
		assertEquals(0, recipe.getPrice());
	}
	
	@Test
	public void testEquals() {
		Recipe tastersChoice = new Recipe();
		tastersChoice.setName("Instant Coffee");

		Recipe folgers = new Recipe();
		folgers.setName("Instant Coffee");

		assertTrue(tastersChoice.equals(folgers));
	}

	@Test
	public void testEqualsNotEqual() {
		Recipe tastersChoice = new Recipe();
		tastersChoice.setName("Instant Coffee");

		Recipe folgers = new Recipe();
		folgers.setName("Folgers");

		assertFalse(tastersChoice.equals(folgers));
	}

	@Test
	public void testEqualsNull() {
		Recipe tastersChoice = new Recipe();

		Recipe folgers = new Recipe();
		folgers.setName("Folgers");

		assertFalse(tastersChoice.equals(folgers));
	}

	@Test
	public void testToString() {
		assertNull(recipe.toString());

		recipe.setName("Starbucks");
		assertSame("Starbucks", recipe.toString());
	}
}
